<!-- include ajax form updater -->
<script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/suppliers.js"></script>
<!-- end include ajax form updater -->

<!-- Left Rail -->
<div class="lCol">
    <h2 class="subheader helpico" {popup width="200" text="Shop Article Suppliers are notified (if set to do so) of every order made of their article!"}>Shop Suppliers</h2>
    <div id="fresh_all">
        <table class="latest" cellspacing="0">
            <tbody>
            {foreach from=$suppliers item=group}
                <tr class="{cycle values="shade,noshade"}" id="group_{$group.id}">
                    <td class="icon">                        
                        <img alt="Public Users Group" src="{$INA.adminTemplate}images/stat_public.gif" align="middle">                        
                    </td>
                    <td class="title" id="group_{$group.id}_data">
                        <span id="group_{$group.id}_title">
                            <a class="messagelink glink" href="javascript: showSupplierInfo({$group.id})"><span id="group_{$group.id}_name">{$group.name|default:'N/A'}</span></a>                            
                        </span>
                        <span style="float: right"><a class="admin" href="javascript:deleteSupplier({$group.id})">X</a>&nbsp;</span>
                        
                        <p class="excerpt">
                          <strong>Tel:</strong>
                          {$group.tel|default:'n/a'}
                          &nbsp;&nbsp;
                          <strong>Fax:</strong>
                          {$group.fax|default:'n/a'}
                          &nbsp;&nbsp;
                          <strong>E-Mail:</strong>
                          {$group.mail|default:'n/a'}
                        </p>
                    </td>
                </tr>
            {foreachelse}
                <tr class="shade">
                    <td class="icon"><img alt="Not Available" src="{$INA.adminTemplate}images/stat_na.gif" align="middle"></td>
                    <td class="title">
                        No Shop Suppliers Listed in the System
                    </td>
                </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>
<!-- End Left Rail -->

<!-- RIGHT RAIL -->
<div class="rCol">    
    <div class="SectionHeader">
        <h2>Things you can do</h2>

        <div class="thingsYouCanDo">
          <a class="admin" href="{$INA.this}" id="addGroup" onClick="hide('confirm'); clearSForm(); return unhide('addGroupForm',true);">Add Supplier</a> 
        </div>
                        
        
        {if $smarty.get.confirm}
            <div id="confirm">
                Successfuly added/updated supplier!
            </div>
        {/if}
            
        <form name="addgroup" method="post" action="{$INA.this}" id="addGroupForm" {if !$groupErrors}style="display: none;"{/if}>
            <table cellspacing="0" cellpadding="0"><tr><td width="50%">
            <table class="smallForm" style="width: 100%" cellpadding=3>
                <tr><td>Please fill out the form below. Mandatory fields are marked bold.</td></tr>
                <tr><td>
                    <label for="addGroupName">Supplier Name</label><br />
                    <input type="text" name="name" value="{$smarty.post.name}" id="addGroupName" class="textInput {if $groupErrors.name}error{/if}" maxlength="128" />
                    {if $groupErrors.name}
                        <span class="errorMessage">Please provide a supplier name</span>
                    {/if}
                </td></tr>
                
                <tr><td>
                    <label for="addGroupAdr1" style="font-weight: normal;">Address Line 1</label><br />
                    <input type="text" name="adr1" value="{$smarty.post.adr1}" id="addGroupAdr1" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupAdr2" style="font-weight: normal;">Address Line 2</label><br />
                    <input type="text" name="adr2" value="{$smarty.post.adr2}" id="addGroupAdr2" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupZIP" style="font-weight: normal;">ZIP</label><br />
                    <input type="text" name="zip" value="{$smarty.post.zip}" id="addGroupZIP" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupCity" style="font-weight: normal;">City</label><br />
                    <input type="text" name="city" value="{$smarty.post.city}" id="addGroupCity" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupCountry" style="font-weight: normal;">Country</label><br />
                    <input type="text" name="country" value="{$smarty.post.country}" id="addGroupCountry" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupTel" style="font-weight: normal;">Tel</label><br />
                    <input type="text" name="tel" value="{$smarty.post.tel}" id="addGroupTel" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupFax" style="font-weight: normal;">Fax</label><br />
                    <input type="text" name="fax" value="{$smarty.post.fax}" id="addGroupFax" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td>
                    <label for="addGroupMail">E-Mail</label><br />
                    <input type="text" name="mail" value="{$smarty.post.mail}" id="addGroupMail" class="textInput {if $groupErrors.mail}error{/if}" maxlength="128" />
                    {if $groupErrors.mail}
                        <span class="errorMessage">Please provide a supplier e-mail contact</span>
                    {/if}
                </td></tr>
                
                <tr><td>
                    <label style="font-weight: normal;">Notification Type</label><br />
                    <select name="notification" id="addGroupNotification">
                        <option value="">----</option>
                        {html_options options=$ntypes selected=$smarty.post.notification}
                    </select>
                    <br />
                </td></tr>
                
                <tr><td>
                    <label style="font-weight: normal;">Notes:</label><br />
                    <textarea class="textInput" rows="5" name="notes" id="addGroupNotes">{$smarty.post.notes}</textarea>
                </td></tr>
                
                
                <tr><td>
                    <input type="hidden" name="id" value="{$smarty.post.id}" id="addGroupID" />
                    <input type="submit" name="addNewSupplier" value="{if $smarty.post.id}Update{else}Add{/if} Supplier" id="sSubmit" class="submitInput" /> <a class="admin" href="{$INA.this}" onClick="clearSForm(); return hide('addGroupForm',true);">Cancel</a>
                </td></tr>
            </table>
            </td><td valign="top" width="50%">
            <table class="smallForm" style="width: 100%" cellpadding=3>
                <tr><td style="border-left: 1px solid #ccc;">Below is a list of 3 possible contacts at this supplier. Fill in as neccessary.</td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">1. Person Name</label><br />
                    <input type="text" name="1pname" value="{$smarty.post.1pname}" id="1pname" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">1. Position</label><br />
                    <input type="text" name="1ppos" value="{$smarty.post.1ppos}" id="1ppos" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">1. Notes</label><br />
                    <textarea class="textInput" rows="3" name="1pnotes" id="1pnotes">{$smarty.post.1pnotes}</textarea>
                </td></tr>
                
                
                <tr><td style="border-left: 1px solid #ccc; border-top: 1px solid #ccc;">
                    <label style="font-weight: normal;">2. Person Name</label><br />
                    <input type="text" name="2pname" value="{$smarty.post.2pname}" id="2pname" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">2. Position</label><br />
                    <input type="text" name="2ppos" value="{$smarty.post.2ppos}" id="2ppos" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">2. Notes</label><br />
                    <textarea class="textInput" rows="3" name="2pnotes" id="2pnotes">{$smarty.post.2pnotes}</textarea>
                </td></tr>
                
                
                <tr><td style="border-left: 1px solid #ccc; border-top: 1px solid #ccc;">
                    <label style="font-weight: normal;">3. Person Name</label><br />
                    <input type="text" name="3pname" value="{$smarty.post.3pname}" id="3pname" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">3. Position</label><br />
                    <input type="text" name="3ppos" value="{$smarty.post.3ppos}" id="3ppos" class="textInput" maxlength="128" />
                </td></tr>
                
                <tr><td style="border-left: 1px solid #ccc;">
                    <label style="font-weight: normal;">3. Notes</label><br />
                    <textarea class="textInput" rows="3" name="3pnotes" id="3pnotes">{$smarty.post.3pnotes}</textarea>
                </td></tr>
                
            </table>
            </td></tr></table>
        </form>
    </div>
</div>
<!-- END RIGHT RAIL -->
{if $smarty.cookies.probableUser}
    <script language="JavaScript" type="text/javascript">showUserInfo({$smarty.cookies.probableUser});</script>
{/if}